import zipfile

zippath = 'test.zip'
pwd_path = 'passwd.txt'
targetpath = '.'
zip = zipfile.ZipFile(zippath)

def unzip(pwd):
    try:
        zip.extractall(path=targetpath, pwd=pwd.encode('utf-8'))
        print(f'密码为：{pwd}')
        return True
    except:
        return False

with open(pwd_path, 'r') as f:
    for pwd in f.readlines():
        pwd = pwd.strip() # 除去字符串两端空格
        if unzip(pwd):
            break # 找到密码后退出